<seed-content class="gray-background">
  <seed-toolbar-header>
    <seed-toolbar-title>{{type=='insert'?'新增地址':'编辑地址'}}</seed-toolbar-title>
    <seed-toolbar-menu></seed-toolbar-menu>
  </seed-toolbar-header>

  <div class="address-form">
    <form [formGroup]="addressForm">
      <div class="group seed-underline">
        <em>收&nbsp;货&nbsp;人</em>
        <div class="content">
          <input type="text" placeholder="请填写真实姓名" formControlName="name" (blur)="nameCheck()">
          <p class="error-tip" *ngIf="error.name && !addressForm.controls['name'].valid" #name>请输入真实姓名</p>
        </div>
        <i class="clear" *ngIf="addressForm.controls['name'].value != ''" (click)="addressForm.controls['name'].setValue('')"></i>
      </div>
      <div class="group seed-underline">

        <em>联系方式</em>
        <div class="content">
          <input type="text" placeholder="请输入手机号码" formControlName="phone" (blur)="phoneCheck()">
          <p class="error-tip" *ngIf="error.phone && !addressForm.controls['phone'].valid" #phone>请输入正确的手机号码</p>
        </div>
        <i class="clear" *ngIf="addressForm.controls['phone'].value != ''" (click)="addressForm.controls['phone'].setValue('')"></i>
      </div>
      <div class="group seed-underline">

        <em>所在地区</em>
        <div class="content">
          <p (click)="showPicker=!showPicker" class="right-arrow-icon">{{regioStr?regioStr:'请选择所在地区'}}</p>
          <p class="error-tip" *ngIf="error.address">请选择所在地区</p>
        </div>
      </div>
      <div class="group address-group">

        <em>详细地址</em>
        <div class="content">
          <textarea placeholder="请输入详细地址" formControlName="detailedAddr" (blur)="detailedAddrCheck()"></textarea>
          <p class="error-tip" *ngIf="error.detailedAddr && !addressForm.controls['detailedAddr'].valid">请输入详细地址</p>
        </div>
      </div>
      <div class="group switch-group beautify">

        <em>设为默认地址</em>
        <div>
          <input type="checkbox" id="defaultAddrSwitch" (change)="handleSwitch($event)">
          <label for="defaultAddrSwitch"></label>
        </div>
      </div>
      <div class="btn-box">
        <button (click)="submitForm()" [disabled]="!addressForm.valid">保存</button>
      </div>
    </form>
    <div class="regio-picker" [class.showPicker]="showPicker">
    <seed-regio-picker (complete)="handleRegioPicker($event)"></seed-regio-picker>
  </div>
  </div>
</seed-content>
